import { registerEditorProvider } from '@ibiz-template/runtime';
import { withInstall } from '@ibiz-template/vue3-util';
import { App } from 'vue';
import { EditorPluginProvider } from './editor.provider';
import { EditorPlugin } from './editor';

export const IBizEditorPlugin = withInstall(EditorPlugin, function (v: App) {
  // 全局注册编辑器插件组件
  v.component(EditorPlugin.name, EditorPlugin);
  // 全局注册编辑器适配器，EDITOR_CUSTOMSTYLE是插件类型，R9EditorPluginId是插件标识
  registerEditorProvider(
    'EDITOR_CUSTOMSTYLE_R9EditorPluginId',
    () => new EditorPluginProvider(),
  );
});

export default IBizEditorPlugin;
